<?php /*a:2:{s:72:"D:\phpstudy_pro\WWW\www.xnadmin.site\app\admin\view\admin_web\index.html";i:1617010109;s:61:"D:\phpstudy_pro\WWW\www.xnadmin.site\app\admin\view\main.html";i:1588058566;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <title><?php echo xn_cfg('base.sys_name'); ?></title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <script>
        //全局上传文件端口
        var UPLOAD_FILE_URL = "<?php echo url('upload_files/upload'); ?>";
        //全局选择文件端口
        var SELECT_FILE_URL = "<?php echo url('upload_files/select'); ?>";
    </script>
    <script src="/static/admin/js/jquery-2.0.0.min.js"></script>
    <script src="/static/admin/js/common.js"></script>
    <script src="/static/admin/js/upload.js"></script>
    <script src="/static/admin/js/webuploader.min.js"></script>
    <link rel="stylesheet" href="/static/admin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/layuiAdmin.css" media="all">
    <link rel="stylesheet" href="/static/admin/style/base.css" media="all">
    
</head>
<body>

<div class="layui-card layadmin-header">
    <div class="layui-breadcrumb" lay-filter="breadcrumb" style="visibility: visible;">
        <a><cite><?php echo htmlentities(get_username($param['admin_id'])); ?></cite></a>
        <a><cite>网站</cite></a>
    </div>
</div>
<div class="layui-fluid">
    <div class="layui-card">
        <div class=" layui-card-header layuiadmin-card-header-auto">
            <form class="layui-form" method="get">
                <input type="hidden" name="bcid" value="<?php echo input('bcid'); ?>"><!--保留当前位置的bcid参数-->
                <div class="layui-form-item">
                    <div class="layui-inline">
                        <a href="<?php echo url('edit',['admin_id'=>$param['admin_id']]); ?>" class="layui-btn" title="添加">
                            分配
                        </a>
                    </div>
                </div>
            </form>
        </div>
        <div class="layui-card-body">
            <table class="layui-table">
                <tr>
                    <th><b>站点名称</b></th>
                    <th><b>URL</b></th>
                    <th><b>账号</b></th>
                </tr>

                <tbody>
                <?php if(is_array($list) || $list instanceof \think\Collection || $list instanceof \think\Paginator): if( count($list)==0 ) : echo "" ;else: foreach($list as $key=>$vo): ?>
                <tr>
                    <td><?php echo htmlentities($vo['title']); ?></td>
                    <td><?php echo htmlentities($vo['url']); ?></td>
                    <td>
                        <?php if(is_site_username($vo['id'],get_username($param['admin_id']))): ?>
                        <a href="javascript:;" class="layui-btn layui-btn-primary layui-btn-xs">
                            账号存在
                        </a>
                        <?php else: ?>
                        <a href="javascript:;" class="layui-btn layui-btn-warm layui-btn-xs" data-webid="<?php echo htmlentities($vo['id']); ?>" onclick="makeSiteUser(this)">
                            一键生成
                        </a>
                        <?php endif; ?>
                    </td>
                </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>
                </tbody>
            </table>
        </div>
    </div>
</div>


<script src="/static/admin/layui/layui.all.js"></script>
<script src="/static/admin/js/admin.js"></script>

<script>
    var username = "<?php echo htmlentities(get_username($param['admin_id'])); ?>";
    function makeSiteUser(obj){
        var webid = $(obj).attr('data-webid');
        $.get("<?php echo url('admin/ajax/makeSiteUser'); ?>",{webid:webid,username:username},function(res){
            if(res.status){
                $(obj).removeAttr('onclick');
                $(obj).removeClass('layui-btn-warm');
                $(obj).text('账号存在');
                $(obj).addClass('layui-btn-primary');
            }
            layer.msg(res.msg);
        });
    }
</script>

</body>
</html>